package com.team24.hotel.service.impl;

import com.team24.hotel.domain.Order;
import com.team24.hotel.mapper.OrderMapper;
import com.team24.hotel.service.FrontOrderService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service

public class FrontOrderServiceImpl implements FrontOrderService {

    @Autowired
    private OrderMapper orderMapper;
    @Override
    public List<Order> listOrder() {
        return orderMapper.selectAll();
    }

    @Override
    public Order selectExtByPrimaryKey(String id) {
        return orderMapper.selectExtByPrimaryKey(id);
    }

    @Override
    public List<Order> selectHistoryAll(String userId) {
        return orderMapper.selectHistoryAllByUserId(userId);
    }

    @Override
    public List<Order> selectAllByUserId(String userId) {
        return orderMapper.selectAllByUserId(userId);
    }

    @Override
    public int updateOrderStatusToCompleted(String id) {
        return orderMapper.updateOrderStatusToCompleted(id);
    }

    @Override
    public int updateOrderStatusToCancel(String id) {
        return orderMapper.updateOrderStatusToCancel(id);
    }

    @Override
    public int updateOrderStatusToNoPay(String id) {
        return orderMapper.updateOrderStatusToNoPay(id);
    }

    @Override
    public int updateOrderStatusToPayed(String id) {
        return orderMapper.updateOrderStatusToPayed(id);
    }


}
